<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
//use Illuminate\Support\Facades\Schema;

class AddFieldToHealthAcupoint20230807 extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('health_acupoint', function (Blueprint $table) {
            $table->integer('wushu_id')->default(0)->comment('五输穴ID');
            $table->integer('teding_id')->default(0)->comment('特定穴ID');
        });

        Schema::table('health_meridian', function (Blueprint $table) {
            $table->string('details_img')->nullable()->comment('详情图片');
            $table->string('time_desc')->default('')->comment('时段');
            $table->longText('xxlx')->nullable()->comment('循行路线');
            $table->longText('zhuzhi')->nullable()->comment('主治');
        });

        Schema::create('health_wushu_acupoint', function (Blueprint $table) {
            $table->id();
            $table->string('name')->comment('名称');
            $table->timestamps();
            $table->comment = '五输穴表';
        });

        Schema::create('health_teding_acupoint', function (Blueprint $table) {
            $table->id();
            $table->string('name')->comment('名称');
            $table->timestamps();
            $table->comment = '特定穴';
        });

        $wushu = ['井穴', '荥穴', '输穴', '经穴', '合穴'];
        $teding = ['原穴', '络穴', '郄穴', '下合穴', '俞穴', '募穴', '经外奇穴'];

        \Illuminate\Support\Facades\DB::table('health_wushu_acupoint')->insert( collect($wushu)->map(function ($item){
            return [
                'name' => $item,
                'created_at' => date('Y-m-d H:i:s'),
                'updated_at' => date('Y-m-d H:i:s'),
            ];
        })->all());

        \Illuminate\Support\Facades\DB::table('health_teding_acupoint')->insert( collect($teding)->map(function ($item){
            return [
                'name' => $item,
                'created_at' => date('Y-m-d H:i:s'),
                'updated_at' => date('Y-m-d H:i:s'),
            ];
        })->all());
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
    }
}
